clear all

** Set working directory: please set your own
/*
cd "~/Dropbox/sanctions_replication/"
*/
** Open dataset
use data/survey_long_format, clear

* Run analyses
local outcomes_within pbeliefs pmoral pharm normexpect smoral sharm

 foreach outcome in `outcomes_within' {
	regr `outcome' up_dummy psoe_dummy i.id, cluster(id)
	est store `outcome'_within
}

* Make table
esttab pbeliefs_within pmoral_within pharm_within normexpect_within smoral_within sharm_within ///
using tables/tableb1.tex, ///
mtitles("Socially appr (self)" "Morally appr (self)" "Harmful (self)"  "Socially appr (others)" "Morally appr (others)" "Harmful (others)"  ) ///
keep(up_dummy psoe_dummy _cons) ///
coeflabels(up_dummy "Podemos" psoe_dummy "PSOE" _cons "Constant") se replace star(* 0.10 ** 0.05 *** 0.01) ///
addnotes("Standard errors are clustered by respondent"  "All models include respondent-level fixed effects")
